package com.example.mapstructdemo;


import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * 多个对象转换成一个对象
 */

@Mapper
public interface StudentManyToOneMapper {

    StudentManyToOneMapper INSTANCE = Mappers.getMapper(StudentManyToOneMapper.class);

    @Mapping(source = "student.gender.name", target = "gender")
    @Mapping(source = "student.birthday", target = "birthday", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(source = "course.courseName", target = "course")
    StudentCourseVO studentAndCourse2StudentVO(Student student, Course course);

}
